atomic: use static inlines instead of macros
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Apr 2014 10:39:23 +0000 (12:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 8 Apr 2014 10:39:23 +0000 (12:39 +0200)
commita8bbd5e7e74cf226c068bb4bfac594cf66697d93
tree25f091ece803f10498348921d3f747b921403247
parentac0f56a2fa407e0704fade12630a5a960dedce87
atomic: use static inlines instead of macros

This is some coverity-inspired tidying.

Coverity has some grief analysing the call sites of atomic_read().  This is
believed to be a bug in Coverity itself when expanding the nested macros, but
there is no legitimate reason for it to be a macro in the first place.

This patch changes {,_}atomic_{read,set}() from being macros to being static
inline functions, thus gaining some type safety.

One issue which is not immediately obvious is that the non-atomic variants take
their atomic_t at a different level of indirection to the atomic variants.

This is not suitable for _atomic_set() (when used to initialise an atomic_t)
which is converted to take its parameter as a pointer.  One callsite of
_atomic_set() is updated, while the other two callsites are updated to
ATOMIC_INIT().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan<tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
[For the arm bits:]
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/common/domain.c
xen/include/asm-arm/atomic.h
xen/include/asm-x86/atomic.h
xen/include/xen/sched.h